package com.acme.bankapp.domain;



import java.util.ArrayList;
import java.util.List;

import com.acme.bankapp.domain.Client;

/**
 * Domain bank
 *
 */
public class Bank {
	
	/**
	 * clients
	 */
	private List<Client> clients = new ArrayList<Client>();
	
	
	public interface ClientRegistrationListener {
			void onClientRegistred(Client client);
	}
	
	private List<ClientRegistrationListener> clientRegistrationListeners = new ArrayList<ClientRegistrationListener>();
	
	void addClientRegistrationListener(ClientRegistrationListener listener){
		clientRegistrationListeners.add(listener);
	}
	
	/**
	 * Get list of bans clients
	 * @return list of clients
	 */
	public List<Client> getClients(){
		return clients;
	}
	
	void addClient(Client client){
		clients.add(client);
		for(ClientRegistrationListener listener : clientRegistrationListeners){
			if(listener!=null){
				listener.onClientRegistred(client);
			}
		}
	}
	
	

}
